<%@page import="java.util.ArrayList"%>
<%@page import="com.iamteer.Student"%>
<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>EL 表达式 1</title>
</head>
<body>
	EL表达式：<br/>
		1. 向浏览器输出域中保存的变量<br/>
		2. 输出对象的属性<br/>
		3. 输出集合<br/>
		4. 表达式计算<br/>
	<br/>
	<%
		String name = "Rose";
		Student student = new Student("Chuck", 18);
		
		List<Student> list = new ArrayList<Student>();
		list.add(new Student("Chuck", 18));
		list.add(new Student("Rose", 43));
		list.add(new Student("Eric", 21));
		
		Map<String, Student> map = new HashMap<String, Student>();
		map.put("001", new Student("Chuck", 18));
		map.put("002", new Student("Rose", 38));
		map.put("003", new Student("Eric", 48));
		
		//放入域中：
		//pageContext.setAttribute("name", name);
		request.setAttribute("name", name);
		pageContext.setAttribute("student", student);
		pageContext.setAttribute("list", list);
		pageContext.setAttribute("map", map);
		
	%>
	<%=name %>
	<br/>
	<%--相当于pageContext.findAtrribute("name") --%>
	EL表达式：${name}
	<br/>
	
	<%--
	相当于pageContext.getAtrribute("name", pageContext.PAGE_SCOPE) 
	pageScope/requestScope/sessionScope/applicationScope
	--%>
	EL表达式：${pageScope.name}
	<br/>
	
	<%--
	相当于 (Student)pageContext.findAttribute("student").getName() 
	规则就是 get+name(N大写)
	.就相当于 getXxx 方法
	--%>
	${student.name } -${student.age }
	<br/>
	
	<%-- []相当于 get 方法--%>
	${list}<br/>
	${list[0]}<br/>
	${list[0].name }-${list[0].age }<br/>
	${list[1].name }-${list[1].age }<br/>
	${list[2].name }-${list[2].age }<br/>
	
	${map }<br/>
	${map['001'] }<br/>
	${map['001'].name }-${map['001'].age }<br/>
	
	<%--1. 算术运算 --%>
	${10+5 }<br/>
	${10*5 }<br/>
	
	<%--2. 比较运算 --%>
	${10 > 5 }<br/>
	${10 < 5 }<br/>
	${20 == 15 }<br/>
	
	<%--3. 逻辑运算 --%>
	${true && false }<br/>
	${true || false }<br/>
	
	<%--4.  判空 null 或 空字符串 --%>
	<%
		//String test = "eric";
		//String test = null;
		String test = "";
		pageContext.setAttribute("test", test);
	%>
	判断 null：${test==null }<br/>
	判断空字符串：${test==null }<br/>
	判空：${test==null || test==""}<br/>
	另一种判空方法：${empty test }
</body>
</html>